﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace FGUFW.Play.StackedTower
{
    public class CameraMove : MonoBehaviour
    {
        public float Speed=2;
        Vector3 _startPos;
        // Start is called before the first frame update
        void Start()
        {
            _startPos = transform.localPosition;
        }

        // Update is called once per frame
        void LateUpdate()
        {
            var pos = _startPos+Vector3.up*StackedTowerManager.I.Level;
            if(transform.localPosition!=pos)
            {
                if(transform.localPosition.y<pos.y)
                {
                    transform.localPosition+=Vector3.up*Speed*Time.deltaTime;
                }
                else
                {
                    transform.localPosition = pos;
                }
            }
        }
    }

}